﻿@model MvcApplication2.Controllers.UserMessageViewModel
@{
}
<div class="page-header">
    <h2>
        <small>Message To : </small>@Model.FormattedDestination <small>from : @Model.FormattedFrom
        </small>
    </h2>
</div>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
<form method="post" class="well form-inline">
@Html.ValidationSummary(true)
<fieldset>
    <legend>@Model.FormattedTitle </legend>
    @Html.HiddenFor(model => model.UserMessageId)
    @Html.HiddenFor(model => model.ExerciseId)
    @Html.HiddenFor(model => model.DestinationId)
    <div class="control-group">
        @Html.LabelFor(model => model.Message, new { @class = "control-label", placeholder = "Message" })
        <div class="controls">
            @Html.TextAreaFor(model => model.Message, new { style = "height:80px ; width:250px" })
            @Html.ValidationMessageFor(model => model.Rating)
        </div>
    </div>
    <div class="form-actions">
        <button class="btn btn-success" type="submit">
            <i class="icon-ok icon-white"></i>Send Message</button>
    </div>
</fieldset>
</form>
<table class="table table-condensed">
    <tr>
        <th>
            From
        </th>
        <th>
            To
        </th>
        <th>
            Date
        </th>
        <th>
            Message
        </th>
    </tr>
    @foreach (var item in Model.PreviousMessages)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.FormattedFrom)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.FormattedTo)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.FormattedDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Message)
            </td>
        </tr>
    }
</table>
<div>
    @Html.ActionLink("Back to List", "Messages", null, new { @class = "btn btn-inverse" })
</div>
